package ru.kreda.webapp.client.ui;

import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.layout.CenterLayout;
import com.google.gwt.user.client.ui.Label;

/**
 * Уведомление пользователю о выполняющейся операции.
 */
public class BusyUIDialog extends WindowBasedUIDialog {
	private final String message;

	public BusyUIDialog(String message) {
		this.message = message;
		int width = message.length() * 10;
		setSize(width, 25);
	}

	@Override
	protected Window create() {
		Window window = new Window();
		window.setLayout(new CenterLayout());
		window.setClosable(false);
		window.setHeaderVisible(false);
		window.setResizable(false);
		window.setMinWidth(10);
		window.setMinHeight(10);
		window.setBodyBorder(true);
		window.setPagePosition(
				(com.google.gwt.user.client.Window.getClientWidth() - getWidth()) / 2, 0);
		window.add(new Label(message, false));
		return window;
	}

}
